package com.ruoyi.web.controller.mtproject;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.MtProBuild;
import com.ruoyi.service.IMtProBuildService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 维保项目收入Controller
 * 
 * @author ruoyi
 * @date 2020-07-04
 */
@Controller
@RequestMapping("/ruoyi/building")
public class MtProBuildMoneyController extends BaseController
{
    private String prefix = "ruoyi/build";

    @Autowired
    private IMtProBuildService mtProBuildService;

    @RequiresPermissions("ruoyi:building:view")
    @GetMapping()
    public String build()
    {
        return prefix + "/buildformoney";
    }

    /**
     * 查询维保项目创建列表
     */
    @RequiresPermissions("ruoyi:building:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(MtProBuild mtProBuild)
    {
        startPage();
        List<MtProBuild> list = mtProBuildService.selectMtProBuildList(mtProBuild);
        return getDataTable(list);
    }

    /**
     * 导出维保项目创建列表
     */
    @RequiresPermissions("ruoyi:building:export")
    @Log(title = "维保项目创建", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(MtProBuild mtProBuild)
    {
        List<MtProBuild> list = mtProBuildService.selectexport(mtProBuild);
        ExcelUtil<MtProBuild> util = new ExcelUtil<MtProBuild>(MtProBuild.class);
        return util.exportExcel(list, "维保项目创建");
    }
}
